#作业2
import  time
def metric(fn):
    def executed(*args,**kw):
        start_time = time.time()
        reslut = fn(*args, **kw)
        end_time = time.time()
        print('耗时：{:.4f}s'.format(end_time - start_time))
        return reslut
    return executed

#装饰器
@metric
def now():
    time.sleep(2)
#测试
now()